#include "../include/ConsumeEvent.h"

ConsumeEvent::ConsumeEvent() : Request(), numOfUnits(0) {}

ConsumeEvent::ConsumeEvent(const Poco::DateTime * const date, int id, ass2::eEnergy energyType ,int _numOfUnits)
	: Request(date, id, energyType), numOfUnits(_numOfUnits) {}

ConsumeEvent::~ConsumeEvent(){
	delete date;
}

//returns posotive int if this happens before other;
//negative if other happens before this; 0 otherwise.
//There is no order between 2 consume events of same date.
int ConsumeEvent::compareTo(Events & other) const {
	int ans = 0;
	ans = (*(other.date) - *(this->date)).days(); //compare dates
	if (ans == 0) //dates are the same
		ans = other.getType() - this->type;//compare event type
	return ans;
}

Events::eEvents ConsumeEvent::getType() const {
	return type;
}
